package com.heima.wemedia.controller;

import com.heima.common.dtos.ResponseResult;
import com.heima.model.admin.dtos.AdUserDto;
import com.heima.model.admin.dtos.LoginResponseDTO;
import com.heima.model.media.dtos.WmUserLoginDto;
import com.heima.wemedia.service.WmUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Fuqiang
 * @since :2023-03-25
 */
@Slf4j
@RestController
public class WmLoginController {

    @Autowired
    WmUserService wmUserService;

    /**
     * 自媒体用户登录
     *
     * @param userLoginDto
     * @return
     */
    @PostMapping("/login/in")
    public ResponseResult<LoginResponseDTO<AdUserDto>> login(@Validated @RequestBody WmUserLoginDto userLoginDto) {

        LoginResponseDTO<AdUserDto> loginResponseDTO = wmUserService.login(userLoginDto);

        return new ResponseResult<LoginResponseDTO<AdUserDto>>(200,loginResponseDTO);
    }
}
